class_name HealthBar
extends Control


@onready var white_border: ColorRect = $WhiteBorder
@onready var content_background: ColorRect = $ContentBackground
@onready var health_gauge: TextureRect = $HealthGauge


## 是否需要反转
@export var is_inverted: bool = false


func refresh(current_health: int, max_health: int):
	var rev := -1 if is_inverted else 1
	white_border.scale.x = rev * (max_health + 2)
	content_background.scale.x = rev * max_health
	health_gauge.scale.x = rev * current_health
